<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2019/12/9
  Time: 20:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<html>
<head>
    <title>Title</title>
    <script src="${pageContext.request.contextPath}/js/jquery.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function(){
            findData();
        })

        function  findData(data) {
            var paras ="";
            if(data!=''){
                paras ='?'+data;
            }

            $.ajax({
                type:"POST",
                url:'${pageContext.request.contextPath}/sc/find',
                dataType:"json",
                success:function(r){
                    // console.log(data)
                    $.each(r,function(i,stu){
                        var str = '<tr>' +
                            '<td>'+(i+1)+'</td>' +
                            '<td>'+stu.name+'</td>' +
                            '<td>'+stu.sex+'</td>' +
                            '<td>'+stu.age+'</td>' +
                            '<td>'+stu.birthday+'</td>' +
                            '<td>'+stu.address+'</td>' +
                            '</tr>';
                        $("#aaa").append(str);
                    })
                }

            })
        }
    </script>
</head>
<body>
<center>
    <h1>学生信息显示</h1>
</center>
    <div style="border:1px solid #383838; margin: 10px;">
        <form style="margin: 5px">
            名称：<input TYPE="text" name="name"/>
            <input type="button" value="查询">
        </form>
    </div>
    <div>
        <table  id="aaa">
            <tr>
                <td style="width: 10px;">&nbsp;</td>
                <td>名称</td>
                <td>性别</td>
                <td>年龄</td>
                <td>出生日期</td>
                <td>家庭住址</td>
            </tr>

        </table>
    </div>
</body>
</html>
